﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace System.Web.Mvc
{
    public static class FormCollectionHelper
    {
        public static string GetString(this FormCollection collection, string index)
        {
            return collection[index];
        }

        public static bool GetBoolen(this FormCollection collection, string index)
        {
            string value = collection[index];
            return String.IsNullOrEmpty(value) || value.Equals("off") || value.Equals("0") ? false : true;
        }

        public static int GetInteger(this FormCollection collection, string index)
        {
            return Convert.ToInt16(collection[index]);
        }
    }
}
